﻿<common:LayoutAwarePage
    x:Name="pageRoot"
    x:Class="Social.Components.Tester.Win8.Views.ImageTools.ImageEdit"
    DataContext="{Binding ImageEdit, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Social.Components.Tester.Win8.Views.ImageTools"
    xmlns:common="using:Social.Components.Tester.Win8.Common"
    xmlns:dc="using:Social.Components.Tester.ViewModel.ImageTools"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:it="using:ImageTools.Controls"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>

        <!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
        <!--<it:ImageConverter x:Key="ImageConverter"/>-->
        <x:String x:Key="AppName">Image Edit</x:String>
    </Page.Resources>

    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid Background="Black">
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <it:ImageEditorContainer x:Name="Container" Grid.Row="1" Margin="40,97,53,10"/>
        
        <StackPanel Orientation="Horizontal" Margin="121,24,111,558" Grid.Row="1">
            <Button x:Name="LoadImage_btn" Content="Choose img" Margin="0,0,30,0" HorizontalAlignment="Left" Height="46" VerticalAlignment="Top" Width="122" Click="LoadImageButton_Click" Grid.Row="1" BorderThickness="2"/>
            <Button x:Name="FlipX_btn" Content="FlipX" Margin="0,0,30,0" HorizontalAlignment="Left" Grid.Row="1" VerticalAlignment="Top" Height="46" Width="86" Click="FlipX_btn_Click"/>
            <Button x:Name="FlipY_btn" Content="FlipY" Margin="0,0,30,0" HorizontalAlignment="Left" Grid.Row="1" VerticalAlignment="Top" Height="46" Width="86" Click="FlipY_btn_Click"/>
            <Button x:Name="RotationLeft_btn" Margin="0,0,30,0" Content="Rotation Left" HorizontalAlignment="Left" Grid.Row="1" VerticalAlignment="Top" Height="46" Width="131" Click="RotationLeft_btn_Click"/>
            <Button x:Name="RotationRight_btn" Margin="0,0,30,0" Content="Rotation Right" HorizontalAlignment="Left" Grid.Row="1" VerticalAlignment="Top" Height="46" Width="135" Click="RotationRight_btn_Click"/>
        </StackPanel>
        <!-- Back button and page title -->
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}" ManipulationMode="None" Foreground="#FF0C0B0B" BorderBrush="Cyan"/>
            <TextBlock x:Name="pageTitle" Grid.Column="1" Text="{StaticResource AppName}" Style="{StaticResource PageHeaderTextStyle}"/>
        </Grid>

        <VisualStateManager.VisualStateGroups>

            <!-- Visual states reflect the application's view state -->
            <VisualStateGroup x:Name="ApplicationViewStates">
                <VisualState x:Name="FullScreenLandscape"/>
                <VisualState x:Name="Filled"/>

                <!-- The entire page respects the narrower 100-pixel margin convention for portrait -->
                <VisualState x:Name="FullScreenPortrait">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>

                <!-- The back button and title have different styles when snapped -->
                <VisualState x:Name="Snapped">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</common:LayoutAwarePage>
